package com.emergency.embackend.controller;


import com.emergency.embackend.common.PageParams;
import com.emergency.embackend.common.R;
import com.emergency.embackend.entity.ContentReturn;
import com.emergency.embackend.service.ContentReturnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/contentReturn")
public class ContentReturnController {
    @Autowired
    private ContentReturnService contentReturnService;

    //添加内容反馈信息
    @PostMapping("addContentReturn")
    public R addContentReturn(@RequestBody ContentReturn contentReturn) {
        //判断是否有数据传入
        if(contentReturn==null){
            return R.error();
        }
        //写入数据
        contentReturnService.addContentReturn(contentReturn);
        return R.ok();
    }
    //删除内容反馈信息
    @GetMapping("delete")
    public R deleteContentReturnById(@RequestParam("contentId")Long contentId){
        contentReturnService.delete(contentId);
        return R.ok();
    }

    //查询
    @PostMapping("/page")
    public R page(@RequestBody PageParams pageParams){
        return R.ok().put("data",contentReturnService.page(pageParams));
    }

}
